@(users: List[gitbucket.core.model.Account], members: Map[String, List[String]], includeRemoved: Boolean)(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Manage Users"){
  @admin.html.menu("users"){
    <div class="pull-right" style="margin-bottom: 4px;">
      <a href="@path/admin/users/_newuser" class="btn btn-default">New User</a>
      <a href="@path/admin/users/_newgroup" class="btn btn-default">New Group</a>
    </div>
    <label for="includeRemoved">
      <input type="checkbox" id="includeRemoved" name="includeRemoved" @if(includeRemoved){checked}/>
      Include removed users
    </label>
    <table class="table table-bordered table-hover">
      @users.map { account =>
        <tr>
          <td @if(account.isRemoved){style="background-color: #dddddd;"}>
            <div class="pull-right">
              @if(account.isGroupAccount){
                <a href="@path/admin/users/@account.userName/_editgroup">Edit</a>
              } else {
                <a href="@path/admin/users/@account.userName/_edituser">Edit</a>
              }
            </div>
            <div class="strong">
              @avatar(account.userName, 20)
              <a href="@url(account.userName)">@account.userName</a>
              @if(account.isGroupAccount){
                (Group)
              } else {
                @if(account.isAdmin){
                  (Administrator)
                } else {
                  (Normal)
                }
              }
              @if(account.isGroupAccount){
                @members(account.userName).map { userName =>
                  @avatar(userName, 20, tooltip = true)
                }
              }
            </div>
            <div>
              <hr>
              @if(!account.isGroupAccount){
                <i class="octicon octicon-mail"></i> @account.mailAddress
              }
              @account.url.map { url =>
                <i class="octicon octicon-home"></i> @url
              }
            </div>
            <div>
              <span class="muted">Registered:</span> @datetime(account.registeredDate)
              <span class="muted">Updated:</span> @datetime(account.updatedDate)
              @if(!account.isGroupAccount){
                <span class="muted">Last Login:</span> @account.lastLoginDate.map(datetime)
              }
            </div>
          </td>
        </tr>
      }
    </table>
  }
}
<script>
$(function(){
  $('#includeRemoved').click(function(){
    location.href = '@path/admin/users?includeRemoved=' + this.checked;
  });
});
</script>